package guice.boot.archive.spi.archive;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import java.util.jar.Manifest;
import java.util.zip.ZipEntry;

/**
 * An archive that can be parsed in uniform style
 */
public interface Archive extends Iterable<Entry> {

    /**
     * Returns a URL that can be used to load the archive.
     */
    URL getUrl() throws MalformedURLException;

    /**
     * Returns the manifest of the archive.
     *
     * @throws IOException if the manifest cannot be read
     */
    Manifest getManifest() throws IOException;

    /**
     * Returns nested {@link Archive}s for entries that match the specified filter.
     *
     * @throws IOException if nested archives cannot be read
     */
    List<Archive> getArchiveList(EntryFilter entryFilter) throws IOException;


    Archive getArchive(Entry entry) throws IOException;


    InputStream getInputStream(ZipEntry zipEntry) throws IOException;

}
